#{extends '/include/main.html' /}
<div class="form-page">
	<a href="@@{AdminController.listUrls()}" class="form-backto-result-button">返回</a>
	#{if url}
		<form action="@@{AdminController.deleteUrl()}?x-http-method-override=DELETE" method="POST" class="delete-form">
			<input type="hidden" name="urlId" value="${url.id}" />
			<input type="submit" value="删除" class="form-submit-zone-submit-button"/>
		</form>
	#{/if}
	<h2 class="form-title">用户管理</h2>
	#{if url}
		<form action="@@{AdminController.updateUrl}?x-http-method-override=PUT" method="POST">
		<input type="hidden" name="urlId" value="${url.id}" />
	#{/if} 
	#{else}
		<form action="@@{AdminController.saveUrl}" method="POST">
	#{/else}
		<table class="form-submit-zone">
			<tbody>
				<tr>
					<th>url对应名字</th>
					<td>
						<input type="text" name="name" value="${(flash.name || flash.name == '') ? flash.name : (url ?.name)}" />
						<div class="error"><span>#{error 'name' /}</span></div>
					</td>
				</tr>
				<tr>
					<th>url对应地址</th>
					<td>
						<input type="text" name="address" value="${(flash.address || flash.address == '') ? flash.address : (url ?.address)}" />
						<div class="error"><span>#{error 'address' /}</span></div>
					</td>
				</tr>
				<tr>
					<th>顺序</th>
					<td>
						<input type="text" name="position" value="${url?.position}" />
					</td>
				</tr>
				<tr>
					<th>提交</th>
					<td>
						<input type="submit" class="form-submit-zone-submit-button"/>
					</td>
				</tr>
			</tbody>
		</table>
	</form>
</div>